#!/bin/bash

# 找到jar包
JAR_FILE=$(find target -name "*.jar" -type f | head -n 1)

if [ -z "$JAR_FILE" ]; then
    echo "没有找到jar包，请先执行 mvn package"
    exit 1
fi

echo "启动应用: $JAR_FILE"
nohup java -jar "$JAR_FILE" > app.log 2>&1 &
echo $! > app.pid

echo "应用已启动，PID: $(cat app.pid)"
echo "日志文件: app.log"
